package com.weipu.common.facade.model;

import org.json.JSONObject;

import com.weipu.common.constants.ServerConstant;

/**
 * @author Tony
 * Currency的数据模型
 */
public class CurrencyModel {
	
	/**
	 * 是否被选中
	 */
	private boolean isChecked;
	/**
	 * 货币简写
	 */
	private String CurrencyCode;
	/**
	 * 国旗图片url
	 */
	private String flagUrl;
	
	/**
	 * 国家代码
	 */
	private String countryCode;
	
	/**
	 * 货币符号
	 */
	private String currencyCodeSymbol;
	
	/**
	 * 是否支持付款
	 */
	private boolean canPay;
	
	/**
	 * 是否支持显示
	 */
	private boolean canShow;
	
	public String getCountryCode() {
		return countryCode;
	}
	public void setCountryCode(String countryCode) {
		this.countryCode = countryCode;
	}
	public String getCurrencyCodeSymbol() {
		return currencyCodeSymbol;
	}
	public void setCurrencyCodeSymbol(String currencyCodeSymbol) {
		this.currencyCodeSymbol = currencyCodeSymbol;
	}
	public boolean isCanPay() {
		return canPay;
	}
	public void setCanPay(boolean canPay) {
		this.canPay = canPay;
	}
	public boolean isCanShow() {
		return canShow;
	}
	public void setCanShow(boolean canShow) {
		this.canShow = canShow;
	}
	public boolean isChecked() {
		return isChecked;
	}
	public void setChecked(boolean isChecked) {
		this.isChecked = isChecked;
	}
	public String getCurrencyCode() {
		return CurrencyCode;
	}
	public void setCurrencyCode(String currencyCode) {
		CurrencyCode = currencyCode;
	}
	public String getFlagUrl() {
		return flagUrl;
	}
	public void setFlagUrl(String flagUrl) {
		this.flagUrl = flagUrl;
	}
	
	
	public static CurrencyModel json2Model(JSONObject json){
		CurrencyModel model =null;
		if(json!=null){
			model = new CurrencyModel();
			model.setCountryCode(json.optString(ServerConstant.CurrencyField.CURRENCY_COUNTRYCODE));
			model.setCurrencyCode(json.optString(ServerConstant.CurrencyField.CURRENCY_CURRENCYCODE));
			model.setCurrencyCodeSymbol(json.optString(ServerConstant.CurrencyField.CURRENCY_CURRENCYCODESYMBOL));
			model.setFlagUrl(json.optString(ServerConstant.CurrencyField.CURRENCY_COUNTRYFLAGURL));
			model.setCanPay(json.optBoolean(ServerConstant.CurrencyField.CURRENCY_CANPAY));
			model.setCanShow(json.optBoolean(ServerConstant.CurrencyField.CURRENCY_CANSHOW));
		}
		return model;
	}
	
}
